import { createRouter, createWebHistory } from "vue-router";
import Home from "@/Home.vue";
import togood from "@/components/togood.vue";

const router = createRouter({
    history: createWebHistory(),
    routes: [
        { path: '/', redirect: '/T11User.vue' },
        { path: '/home', component: Home },
        { path: '/togood', component: togood},
        { path: '/T01button', component: ()=>import('@/components/element/T01Button.vue')},
        { path: '/T02el-container', component: ()=>import('@/components/element/T02el-container.vue')},
        { path: '/T03clcol.vue', component: ()=>import('@/components/element/T03clcol.vue')},
        { path: '/T04ellink.vue', component: ()=>import('@/components/element/T04ellink.vue')},
        { path: '/T05el-radio.vue', component: ()=>import('@/components/element/T05el-radio.vue')},
        { path: '/T06el-checkbox.vue', component: ()=>import('@/components/element/T06el-checkbox.vue')},
        { path: '/T07input.vue', component: ()=>import('@/components/element/T07input.vue')},
        { path: '/T08select.vue', component: ()=>import('@/components/element/T08select.vue')},
        { path: '/T09DatePicker.vue', component: ()=>import('@/components/element/T09DatePicker.vue')},
        { path: '/T10user.vue', component: ()=>import('@/components/element/T10user.vue')},
        { path: '/T11User.vue', component: ()=>import('@/components/element/T11User.vue')},

        { path: '/cart.vue', component: ()=>import('@/cart.vue')},
        { path: '/order.vue', component: ()=>import('@/order.vue')},
        { path: '/about', component: () => import('@/components/About.vue') },
        {path: '/productDetail', component: () => import('@/components/ProductDetail.vue'),
            beforeEnter : (to,from,next)=>{
                console.log('路由独享守卫'+to)
                console.log('路由独享守卫'+from)
                next();//放行进入
            }
        }
    ],
});
//全局前置路由守卫
router.beforeEach((to,from,next)=>{
    console.log(to)
    console.log(from)
    next();//放行进入
})

export default router;